#!/bin/bash
##
# 方法添加前缀
###
function addpre(){
    str=`gsed -i 's/\+[ ]*\(void\)/&jt_/g' $1`
    echo "$str"
}

function oper_addpre(){
    for file in $1/*
    do
      echo "$file"
      if [[ $file =~ " " ]]
      then
          continue
      fi
      if [ -f "$file" ]
      then
        if [[ "$file" == *.h* || "$file" == *.m* || "$file" == *.swift* || "$file" == *.xib* || "$file" == *.storyboard* ]] && [[ "$file" != *.mp3* ]] && [[ "$file" != *.mp4* ]]
        then
           str=`gsed -i 's/\+[ ]*\(void\)/&$2/g' $1`
        fi
      else
          if [ "`ls -A $file`" != "" ]
          then
              oper_addpre "$file" $2
          fi
      fi
    done
}

#read -p "Folder path:" path;
#addpre "$path";
